package com.edmond.jyframe.fragments;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.edmond.jyframe.R;
import com.edmond.jynet.network.StringNetWork;
import com.edmond.jynet.network.base.BaseStringNetWork;

/**
 * Created by edmond on 17-4-28.
 */

public class LoginAccountFragment extends Fragment {

    private View view;
    private Button loginButton;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_login_account,container,false);

        loginButton = (Button) view.findViewById(R.id.login_button);

        loginButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                StringNetWork stringNetWork = new StringNetWork(0, "https://www.baidu.com", new BaseStringNetWork.BaseStringListener<Object>() {
                    @Override
                    public void onStart(int what) {

                    }

                    @Override
                    public void onSucceed(int what, Object response) {
                        Log.d("sdf", String.valueOf(response));
                    }

                    @Override
                    public void onFailed(int what, String url, Object tag, Exception exception, int responseCode, long networkMillis) {

                    }

                    @Override
                    public void onFinish(int what) {

                    }

                    @Override
                    public void onJsonError(Exception e) {
                        e.printStackTrace();
                    }
                },null);

                stringNetWork.doIt();
            }
        });

        return view;
    }
}
